<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:choose>
	<c:when test="${empty errorMsg }">
<script type="text/javascript">
<!--
function bal_telfee_new_list_subApp(){
	var checkBoxs = $("input:checkbox[name=bal_telfee_new_ids]:checked",navTab.getCurrentPanel());
	if(checkBoxs=="" || checkBoxs.length <= 0){
		alertMsg.info("请至少勾选一条明细信息！");
		return false;
	}
	
	var balIds = "";
	for(var i=0; i<checkBoxs.length; i++){
		var balId = checkBoxs[i].value;
		balIds += "," + balId;
	}
	if(balIds!=""){ 
		balIds = balIds.substring(1);
    }
	alertMsg.confirm("确定要提交申请吗?",{
		okCall: function(){
			$.post("bal_appTelFee.action", {"balIds":balIds,"totalFee":$("#bal_telfee_new_list_totalFee",navTab.getCurrentPanel()).val()}, function(data){
				dialogAjaxDone(data);
			}, "json"); 
			return true;
		}
	});
	return false;
}

function bal_telfee_new_list_check(obj,type){
	var checkBoxs;
	if(type==1){
		var totalFee = "0.0";
		if(obj.checked){
			checkBoxs = $("input:checkbox[name=bal_telfee_new_ids]",navTab.getCurrentPanel());
			for(var i=0; i<checkBoxs.length; i++){
				var balId = checkBoxs[i].value;
				var currentBalFee = $("#bal_telfee_new_list_balFee_"+balId,navTab.getCurrentPanel()).val();
				if(currentBalFee != ""){
					totalFee = parseFloat(totalFee) + parseFloat(currentBalFee);
				}
			}
			$("#bal_telfee_new_list_totalFee",navTab.getCurrentPanel()).val(totalFee.toFixed(2));
		}else{
			$("#bal_telfee_new_list_totalFee",navTab.getCurrentPanel()).val("0.0");
		}
	}else{
		var totalFee = "0.0";
		checkBoxs = $("input:checkbox[name=bal_telfee_new_ids]:checked",navTab.getCurrentPanel());
		for(var i=0; i<checkBoxs.length; i++){
			var balId = checkBoxs[i].value;
			var currentBalFee = $("#bal_telfee_new_list_balFee_"+balId,navTab.getCurrentPanel()).val();
			if(currentBalFee != ""){
				totalFee = parseFloat(totalFee) + parseFloat(currentBalFee);
			}
		}
		$("#bal_telfee_new_list_totalFee",navTab.getCurrentPanel()).val(totalFee.toFixed(2));
	}
}
//-->
</script>
<form id="pagerForm" onsubmit="return divSearch(this, 'bal_telfee_new_list');" 
 action="bal_telfeeNewList.action" method="post" >
	<input type="hidden" name="pageNum" value="1" />
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
</form>
<div class="pageHeader">
	<div class="searchBar">
		<table class="searchContent">
			<tr>
				<td>
					申请人：
				</td>
				<td>
					${session.currentUser.userName }
				</td>
				
				<td>
					申请日期:
				</td>
				<td>
					${currentDate }
				</td>
				<td>
					申请金额:
				</td>
				<td>
					<input id="bal_telfee_new_list_totalFee" type="text" value="0.00" readonly="readonly" />
				</td>
			</tr>
		</table>
		
	</div>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="javascript:void(0);" onclick="javascript:return bal_telfee_new_list_subApp();" ><span>提交【<font color="blue">现金激励学校结算</font>】申请</span></a></li>
		</ul>
	</div>

	
	<table class="table" width="100%" layoutH="147" rel="bal_telfee_new_list">
		<thead>
			<tr>
				<th><input type="checkbox" group="bal_telfee_new_ids" class="checkboxCtrl"  onclick="javascript:bal_telfee_new_list_check(this,1);"></th>
				<th>序号</th>
				<th>学校名称</th>
				<th>结算日期</th>
				<th>拓展人员</th>
				<th>维护人员</th>
				<th>电话费</th>
				<th>操作员费用</th>
				<th>结算费用</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${recordList }" var="bal" varStatus="status">
			<tr>
				<td>
					<input name="bal_telfee_new_ids" value="${bal.uuid}" type="checkbox" onclick="javascript:bal_telfee_new_list_check(this,2);">
					<input id="bal_telfee_new_list_balFee_${bal.uuid}" type="hidden" value="${bal.balFee }">
				</td>
				<td>${(status.index+1) + (currentPage-1) * numPerPage}</td>
				<td>${bal.sclName }</td>
				<td>${bal.ywEndDate }</td>
				<td>${bal.saleUserName}</td>
				<td>${bal.saleKeepName}</td>
				<td><fmt:formatNumber value="${bal.telFee}" type="number" pattern="￥0.00" /></td>
				<td><fmt:formatNumber value="${bal.operFee}" type="number" pattern="￥0.00" /></td>
				<td><fmt:formatNumber value="${bal.balFee}" type="number" pattern="￥0.00" /></td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>页次&nbsp;${currentPage }&nbsp;/&nbsp;${pageCount }&nbsp;页，</span>
			<select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value}, 'bal_telfee_new_list')">
				<option  ${numPerPage==20?"selected":"" } value="20">20</option>
				<option  ${numPerPage==50?"selected":"" } value="50">50</option>
				<option  ${numPerPage==100?"selected":"" } value="100">100</option>
				<option  ${numPerPage==150?"selected":"" } value="150">150</option>
				<option  ${numPerPage==200?"selected":"" } value="200">200</option>
			</select>
			<span>条，共${recordCount}条</span>
		</div>
		<div class="pagination" 
			rel="bal_telfee_new_list" 
			totalCount="${recordCount}"
			numPerPage="${pageSize}" 
			pageNumShown="${pageNumShown}"
			currentPage="${currentPage }">
		</div>
	</div>
	
</div>
</c:when>
	<c:otherwise>
		<div style="padding: 5px;color: red;">页面加载错误！${errorMsg }</div>
	</c:otherwise>
</c:choose>